package com.hundsun.cprs.yyt.service.common.enums;

import org.apache.commons.lang.StringUtils;

/**
 * 简单基础系统返回码的提示信息转换枚举类
 * @author linrl
 * @date 2018年4月11日
 */
public enum EnumMessageMapping {
    
    UC_1002999_MESSAGE("01002999","支付宝账号不能重复","alipay","银行账号");

    private String remoteCode;
    private String message;
    private String extCode;
    private String filterValue;
    
    private EnumMessageMapping(String remoteCode,String message,String extCode,String filterValue){
        this.remoteCode = remoteCode;
        this.message = message;
        this.extCode = extCode;
        this.filterValue = filterValue;
    }
    
    /**
     * 全局索引池
     */
   /* private static Map<String, EnumMessageMapping> extCodePool = new HashMap<String, EnumMessageMapping>();
    static {
        for (EnumMessageMapping et : EnumMessageMapping.values()) {
            extCodePool.put(et.remoteCode + et.extCode, et);
        }
    }*/
    
    public static String getMappingMessage(String remoteCode,String extCode,String filterValue,String defaultValue){
        for (EnumMessageMapping et : EnumMessageMapping.values()) {
            if(StringUtils.equals(et.remoteCode, remoteCode) &&
                StringUtils.equals(et.extCode, extCode) &&
                StringUtils.contains(filterValue, et.filterValue)){
                return et.getMessage();
            }
        }
        return defaultValue;
    }

    public String getRemoteCode() {
        return remoteCode;
    }

    public String getMessage() {
        return message;
    }

    public String getExtCode() {
        return extCode;
    }

    public String getFilterValue() {
        return filterValue;
    }
}
